Skip to content

Trim leading and trailing whitespace from column names entered in the Column, Table and ERD table dialogs. #5930 - #10839

Merged
dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix-issue-5930
Nov 27, 2026
Merged

dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix-issue-5930

Conversation

@dpage

@dpage dpage commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The column Name field (Column dialog, the Columns grid in the Table dialog, and the ERD table dialog, which all share ColumnSchema) now trims leading and trailing whitespace when the user leaves the field, so a stray space no longer creates a column that can only be queried as " name ".
  • This is done with a new trimOnBlur option in controlProps for InputText. It trims on blur rather than per keystroke, so names with interior spaces can still be typed, and only after the user has edited the value, so focusing an existing column whose name really does have surrounding whitespace will not rename it.
  • The auto-concatenation / snake_case conversion also suggested in the issue is deliberately out of scope: names with interior spaces are valid quoted identifiers, and rewriting them would be a separate design decision.

Test plan

  • Jest: FormComponents.spec.js (trim on blur, no trim when disabled, no trim of an unedited value), column.ui.spec.js, table.ui.spec.js
  • eslint on the changed files

Closes #5930

Summary by CodeRabbit

  • New Features
    • Column names are now trimmed of leading and trailing whitespace after editing when the Name field loses focus.
  • Documentation
    • Updated the column and table dialog guides to describe the trimming behavior.

… Column, Table and ERD table dialogs. pgadmin-org#5930

The column name field now trims the value when the user leaves it, so a
stray space no longer produces a column that has to be quoted with the
space in every query. Trimming happens on blur rather than on every
keystroke so that names containing interior spaces can still be typed,
and only after the user has edited the field, so focusing an existing
column whose name genuinely has surrounding whitespace does not rename it.

Closes pgadmin-org#5930
@dpage dpage self-assigned this Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The InputText component can trim edited values on blur when enabled. The column name field enables this behavior, and the documentation and tests cover it.

Changes

Column name trimming

Layer / File(s) Summary
InputText blur trimming
web/pgadmin/static/js/components/FormComponents.jsx, web/regression/javascript/components/FormComponents.spec.js
InputText tracks edits and trims an edited string on blur when trimOnBlur is enabled. It calls onChange if trimming changes the value. Tests cover enabled and disabled trimming and unchanged values.
Enable trimming for column names
web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js, web/regression/javascript/schema_ui_files/column.ui.spec.js, docs/en_US/column_dialog.rst, docs/en_US/table_dialog.rst
The column name field enables trimming on blur. The test checks this setting, and the documentation describes the behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant InputText
  participant ColumnForm
  User->>InputText: Edit column name
  User->>InputText: Leave field
  InputText->>InputText: Trim value when enabled and edited
  InputText->>ColumnForm: Report changed value
Loading
Merge Risk: Minimal · up to dab61

Column names in the Column, Table and ERD dialogs now have leading and trailing whitespace trimmed when the user leaves the field. Existing unedited names are left alone. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: column names entered in the Column, Table and ERD table dialogs have leading and trailing whitespace trimmed. The raw summary and PR objectives confirm that the chang…
Linked Issues check Passed Directly linked issue #5930 has one core coding request: automatic trimming of leading and trailing whitespace in column names. The PR meets it. In web/pgadmin/static/js/components/FormComponents.jsx,…
Out of Scope Changes check Passed All changed files relate to the trimming objective. The changes are: FormComponents.jsx (the trimOnBlur option, gated by the flag, so other InputText users are unaffected unless they set the flag); co…
Full details: Title check

Explanation

The title states the main change: column names entered in the Column, Table and ERD table dialogs have leading and trailing whitespace trimmed. The raw summary and PR objectives confirm that the changeset adds trim-on-blur to the shared column name field, updates the docs, and adds tests for this behavior. The title does not mention the blur timing or the edited-only condition, which is acceptable because the title need not cover every detail. The title is specific and does not use vague terms.

Full details: Linked Issues check

Explanation

Directly linked issue #5930 has one core coding request: automatic trimming of leading and trailing whitespace in column names. The PR meets it. In web/pgadmin/static/js/components/FormComponents.jsx, InputText reads a new controlProps.trimOnBlur flag. On blur, when the user has edited the value and the value is a string, it trims the value, updates the field, and calls onChange with the trimmed value. The column.ui.js name field sets trimOnBlur: true. ColumnSchema is shared, so the Column dialog, the Table dialog Columns grid, and the ERD table dialog all receive the behavior. FormComponents.spec.js and column.ui.spec.js cover the flag. Issue #5930 also asks for automatic concatenation of multi-word names (for example, first_name) with a notification. It states this as a 'would be great' suggestion, not as the main request. The PR does not implement it and states that it is out of scope as a separate design decision. This is a deliberate scope limit, not a failure of the trimming objective. Remaining uncertainty: the issue does not define concatenation as a firm requirement, so this assessment treats it as secondary.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the trimming objective. The changes are: FormComponents.jsx (the trimOnBlur option, gated by the flag, so other InputText users are unaffected unless they set the flag); column.ui.js (sets trimOnBlur on the name field); FormComponents.spec.js and column.ui.spec.js (tests for the new behavior); and column_dialog.rst and table_dialog.rst (documentation of the trimming behavior). No unrelated code change appears in the reviewed summary or the FormComponents.jsx diff. The change to InputText also stops forwarding trimOnBlur as a DOM input prop. This change supports the new option and does not alter other behavior.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3b6b9b2 and dab6156.

Files selected for processing: 6

  • docs/en_US/column_dialog.rst
  • docs/en_US/table_dialog.rst
  • web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js
  • web/pgadmin/static/js/components/FormComponents.jsx
  • web/regression/javascript/components/FormComponents.spec.js
  • web/regression/javascript/schema_ui_files/column.ui.spec.js

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

@dpage
dpage merged commit 46b00d2 into pgadmin-org:master Nov 27, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating Columns Names on pgAdmin 4 GUI

1 participant